﻿using System;
using System.Collections.Generic;
using System.Text;

namespace DeepHash.Document
{
    /// <summary>
    /// Represents an entity to store file verification results
    /// </summary>
    [System.Xml.Serialization.XmlRoot("record")]
    public class FileVerificationRecord : VerificationRecord
    {
        private byte[] _hash;

        /// <summary>
        /// Hash value of the files content
        /// </summary>
        [System.Xml.Serialization.XmlIgnore]
        public byte[] Hash
        {
            get { return _hash; }
            set 
            {
                try
                {
                    _hashString = Utility.ByteArrayToHexString(value);
                    _hash = value;
                }
                catch
                { }
            }
        }

        private string _hashString = string.Empty;
        /// <summary>
        /// Hexadedecimal value of the hash bytes
        /// </summary>
        [System.Xml.Serialization.XmlAttribute("hash")]
        public string HashString
        {
            get { return _hashString; }
            set 
            {
                try
                {
                    _hash = Utility.HexStringToByteArray(value);
                    _hashString = value;
                }
                catch { }
            }
        }

    }
}
